<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head th:replace="fragment :: common_header(~{::title},~{::script},~{},~{::style})">
    <title>新增分类</title>
    <script type="text/javascript" th:src="@{/console/shopType/shopType.js}"></script>
    <script type="text/javascript">
        $(function () {
            var option = $("#option").val();
            if(option == 'look'){
                $("input").attr("disabled","disabled");
                $("textarea").attr("disabled","disabled");
                $("input").css("background","#cccccc");
                $("#saveBtn").hide();
                $("#title").html("查看");
            }else if(option == ''){
                $("#title").val("修改");
                $("#saveBtn").show();
            }
        })
    </script>
    <style type="text/css">
        .formtable{
            margin-top:50px;
        }
    </style>
</head>
<body>
<div class="container formtable">
    <div class="row">
        <h3 class="text-center"><span id="title">修改</span>商品分类</h3>
        <hr/>
        <br/>
    </div>
    <div class="row">
        <form id="saveForm" class="form-horizontal" role="form" th:action="@{/console/updateShopType}">
            <input type="hidden" id="option" name="option" th:value="${option}"/>
            <input type="hidden" id="id" name="id" th:value="${shopType.id}"/>
            <div class="form-group row">
                <label for="typeName" class="col-sm-2 text-right">分类名称：</label>
                <div class="col-sm-3 text-left">
                    <input id="typeName" name="typeName" type="text" placeholder="分类名称" th:value="${shopType.typeName}"/>
                </div>
                <label for="parent" class="col-sm-2 text-right">选择父类：</label>
                <div class="col-sm-3 text-left">
                    <input id="parent" name="parent" type="text" readonly th:value="${shopType.parentType!=null?shopType.parentType.typeName:''}"/>
                </div>
            </div>
            <div class="form-group row">
                <label for="remark" class="col-sm-2 text-right">备注说明：</label>
                <div class="col-sm-3 text-left">
                    <textarea id="remark" name="remark" type="text" cols="44" rows="5" placeholder="备注" th:text="${shopType.remark}"></textarea>
                </div>
                <!--<label for="time" class="col-sm-2 text-right">选择父类：</label>
                <div class="col-sm-3 text-left">
                    <input id="time" name="time" type="text"/>
                </div>-->
            </div>
            <div class="row text-center">
                <input id="saveBtn" class="btn btn-sm btn-info" value="保存" type="button" onclick="updateShopType()"/>
            </div>
        </form>
    </div>
</div>
</body>
</html>